package com.gopay.common.constants.trans;

/**
 * 手续费付款方
 * @OrderFeePayer.java
 * @author HJY
 * @2013-1-11 下午02:07:46  www.gopay.com.cn Inc.All rights reserved.
 */
public enum OrderFeePayer {

    /**
     * 0 - 不涉及
     */
    NO_PAYER("00"),
    
    /**
     * 1 - 付方承担
     */
    PAY_PAYER("01"),
    
    /**
     * 2 - 收方承担
     */
    REC_PAYER("02"),

    /**
     * 3 - 平台商户承担
     */
    MER_PAYER("03");

    public final  String  value;
    
    private OrderFeePayer(String value){
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    } 
    
    public static OrderFeePayer toValue(String value){
        if(value==null||value.length()!=2) {
            return null;
        }
        OrderFeePayer fp = null;
        switch (value.toCharArray()[1]) {
        case '0':
            fp =  OrderFeePayer.NO_PAYER;
            break;
        case '1':
            fp =  OrderFeePayer.PAY_PAYER;
            break;
        case '2':
            fp =  OrderFeePayer.REC_PAYER;
            break;
        case '3':
            fp =  OrderFeePayer.MER_PAYER;
            break;
        }
        return fp;
    }
}
